import Vue from 'vue'
import Vuex from 'vuex'
import obj from '../api'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        menu: [],
    },
    mutations: {
        setMenu: function (state, nv) {
            state.menu = nv;
        }
    },
    actions: {
        // getMenu(store) {
        //     console.log(obj.doMenus);
        //     return obj.doMenus()
        //         .then((temp) => {
        //             store.commit("setMenu", temp)
        //         })
        // }
        async getMenu(store){
            let temp= await obj.doMenus()
            store.commit("setMenu", temp)
            return temp;
        }
    },
    modules: {

    }
})
